<template>
	<view class="page tn-safe-area-inset-bottom" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
		<view class="top-bg"></view>
		<dawnBar title="来院导航"></dawnBar>
		<view class="page-container" style="padding-bottom: 140rpx;">
			<!-- 医院信息 -->

			<view class="" v-if="list.length > 0">
				<block v-for="(item, index) in list" :key="index">
					<view @click="newsDteail(item)"
						class="tn-bg-white dawn-shadow dawn-radius tn-margin-bottom-sm dawn-radius tn-padding-sm">
						<view class="tn-flex tn-flex-col-center">
							<view class="tn-margin-right-ss">
								<image mode="scaleToFill" class="map-image" :src="item.coverImg" />
							</view>
							<view class="tn-flex tn-flex-col-center tn-flex-row-between" style="width: 100%;">
								<view class="tn-padding-left-xs tn-padding-right-ss">
									<view class="dawn-text-md tn-text-bold">
										{{ item.title }}
									</view>
									<view class="tn-margin-top-xs tn-flex tn-flex-col-center">
										<text class="tn-icon-map-fill tn-margin-right-ss dawn-text-sm"></text>
										<text class="dawn-text-sm tn-color-gray">
											{{ item.description }}
										</text>
									</view>
								</view>
								<view class="tn-flex tn-flex-nowrap tn-flex-col-center tn-flex-row-right">
									<view class="tn-text-right">
										<text class="tn-icon-send-fill dawn-color"></text>
									</view>
								</view>
							</view>

						</view>
					</view>
				</block>
			</view>

			<view v-if="show">
				<dawnMsg :box="dawnMsgBox" :msg="msg"></dawnMsg>
			</view>
		</view>

		<!-- loading -->
		<dawnLoading :show="loading"></dawnLoading>

		<!-- 悬浮按钮-->
		<NavBtn></NavBtn>
	</view>
</template>

<script>
	import page_mixin from '@/mixins/page_mixin.js'
	import dayjs from '@/plugin/dayjs/dayjs.min.js';
	import * as ArticleApi from '@/api/cms/article.js';
	import * as api from '@/api/api.js';
	import * as config from "@/api/config.js";
	import {
		toLogin
	} from '@/libs/login.js';
	import {
		mapGetters
	} from "vuex";
	const app = getApp();

	export default {
		name: 'order',
		mixins: [page_mixin],
		computed: mapGetters(['appConfig', 'uid', 'isLogin', 'userInfo', 'patientInfo']),
		data() {
			return {
				loading: false,
				show: false,
				msg: '',
				dawnMsgBox: '',
				list: []
			}
		},
		onLoad(options) {
			this.getData();
		},
		onShow() {
			// this.getData();
		},
		methods: {
			getData() {
				let that = this;
				this.loading = true;
				this.show = false;
				this.$set(this, 'list', []);
				ArticleApi.getArticlePage({
					categoryKey: config.CMS_TYPE.MAP
				}).then(res => {
					this.loading = false;
					console.table(res)
					if (res.code === 0) {
						const l = res.data.list || [];
						if (l.length > 0) {
							that.$set(this, 'list', l);
						} else {
							that.show = true;
							that.msg = "暂无数据";
						}
					}
				});
			},
			formatDate: function(date) {
				return dayjs(date).format("YYYY-MM-DD");
			},
			formatDateTime: function(date) {
				return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tn-avatar {
		z-index: 0 !important;
	}
</style>